//邻接矩阵测试(深度优先遍历)
#include <iostream>
#include "amgraph.h"

using namespace std;

int main()
{
    //建立图
    //G=({A,B,C,D,E},{AB,AC,CB,CD,DB,EA,ED})
    AMGraph<char, int> G;
    InitGraph(G);

    int a = AddVertex(G, 'A');
    int b = AddVertex(G, 'B');
    int c = AddVertex(G, 'C');
    int d = AddVertex(G, 'D');
    int e = AddVertex(G, 'E');

    AddArc(G, a, b, 1);
    AddArc(G, a, c, 1);
    AddArc(G, b, e, 1);
    AddArc(G, c, b, 1);
    AddArc(G, c, d, 1);
    AddArc(G, d, b, 1);
    AddArc(G, e, a, 1);
    AddArc(G, e, d, 1);

    //深度优先搜索
    auto print = [](char c) {
        cout << c;
    };
    DFSTraverse(G, print);

    //销毁图
    DestroyGraph(G);

    return 0;
}